import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
// import {baseUrl} from "../request/https.js"
const baseUrl = 'https://lawyer.yic3.cn/'
const store = new Vuex.Store({
	state: {
		userInfo: {},
		vipAgree: false,
		iosEnvir:'prod',//sandbox // prod
		agreementList: {
			user: baseUrl + 'h5/user.html', //服务协议 用户协议
			provacy: baseUrl + 'h5/provacy.html', //隐私政策
			sdk: baseUrl + 'h5/sdk_list.html', //SDK目录
			authority: baseUrl + 'h5/permission.html', //权限说明
		},
	},
	mutations: {
		updateUserInfo(state, data) {
			state.userInfo = data
		},
		// vip弹窗显示
		updateVipagree(state, data) {
			state.vipAgree = data
		},
	},
	actions: {
		async getUserInfo({
			commit
		}) {
			await uni.$api.getUserInfo().then(async res => {
				console.log(res);
				if (res.data.code == 0) {
					await commit('updateUserInfo', res.data.data)
				}
			})
		},
	}
})
export default store